#!/bin/bash

ls | grep '\.alice$' | while read line
do
	base=`basename $line .alice`
	./compiler $base.alice
	echo $? > compilation.oo
	diff compilation.oo "$base.compilation"
	if ( ! $? eq 0 )
		echo "file does not have correct compilation return code"
	fi

	./$base < "$base.00.input" > output.oo

	diff output.oo "$base.00.output"
	if ( ! $? eq 0 )
		echo "output is not the same"
	fi
	
done
